import React, {Component} from 'react';
import {Button} from '@alifd/next';
import QueueAnim from 'rc-queue-anim';
import Texty from 'rc-texty';
import TweenOne from 'rc-tween-one';
import Logo from './../../../../components/Logo';
import Login from '../Login';
import styles from './index.module.scss';
import 'rc-texty/assets/index.css';
import axios from 'axios';
import MenuItems from './../MenuItems';
// import Header from './../../../../components/Header';
import {connect} from "react-redux";
import MainData from "../MainData";

var accessNum_1 = 0;
var accessNum_2 = 0;
var TweenOneGroup = TweenOne.TweenOneGroup;

class ExcellentHomePage extends Component {
    static displayName = 'ExcellentHomePage';

    componentDidMount() {
        const _this = this;
        axios.defaults.withCredentials = false;
        axios.get('https://api.tju.ink/website/addaccesslog?url=http://47.105.62.140/tjufe/&marks=总浏览量')
            .then(function (res) {
                setTimeout(function () {
                    axios.get('https://api.tju.ink/website/getaccessnumber?url=http://47.105.62.140/tjufe/')
                        .then(function (response_1) {
                            accessNum_1 = response_1.data.number;
                            axios.get('https://api.tju.ink/website/getaccessnumber?url=http://47.105.62.140/tjufe/unity/')
                                .then(function (response_2) {
                                    accessNum_2 = response_2.data.number;
                                    _this.props.onSetAccessNumber(accessNum_1, accessNum_2);
                                })
                        });
                }, 1000);
            })
    }

    handleClickMore() {
        console.log("Click More");
    }

    render() {
        return (
            <div className={styles.excellentHomePage} style={{height: '100vh'}}>
                <div className={styles.row}>
                    <div className={styles.title}>
                        <div className={styles.excellentHomePageTitle}>
                            <span>三维可视化财税综合</span>
                            <br/>
                            <span>仿真系统</span>
                            <br/>
                            <h4>建议使用：【 Google Chrome浏览器】【 Firefox浏览器】</h4>
                            <h4>访问电脑配置建议： 8GB内存、64位操作系统</h4>
                        </div>
                    </div>
                    <div className={styles.floatDiv} key="floatDiv">
                        <Login/>
                    </div>
                </div>
            </div>
        );
    }
}

const mapStateToProps = (state) => {
    return {
        acccessNumber_index: state.access.acccessNumber_index,
        accessNumber_do: state.access.accessNumber_do,
    };
};
const mapDispatchToProps = (dispatch) => {
    return {
        onSetAccessNumber(par1, par2) {
            console.log('即将设置访问量...', par1);
            const action = {
                acccessNumber_index: par1,
                accessNumber_do: par2,
                type: "setAccessNumber",
            };
            dispatch(action);
        }
    };
};
export default connect(mapStateToProps, mapDispatchToProps)(ExcellentHomePage);
